//头文件声明
#include "display.h"

unsigned char code leddata[] = { //数码管的段码表
 
                0x3F,  //"0"
                0x06,  //"1"
                0x5B,  //"2"
                0x4F,  //"3"
                0x66,  //"4"
                0x6D,  //"5"
                0x7D,  //"6"
                0x07,  //"7"
                0x7F,  //"8"
                0x6F,  //"9"
                0x77,  //"A"
                0x7C,  //"B"
                0x39,  //"C"
                0x5E,  //"D"
                0x79,  //"E"
                0x71,  //"F"
                0x76,  //"H"
                0x38,  //"L"
                0x37,  //"n"
                0x3E,  //"u"
                0x73,  //"P"
                0x5C,  //"o"
                0x40,  //"-"
                0x00,  //熄灭
 
                         };
unsigned char LEDBuff[] = { 0,0,0,0,0,0,23,23 };//数据缓冲区
unsigned char code PLACE_CODE[] = { 0xFF,0xFB,0xF7,0xF3,0xEF,0xEB,0xE7,0xE3 };//位选信号

/***********************************
函数名：Display
功  能：数码管动态显示
参  数：无
返回值：无
*************************************/
void Display()
{
	 unsigned char i;
	//1、送段码
	//2、送位选
	//3、延时 1ms < 10ms
	//4、消隐
	switch(i)
	{
		case 0:
			GPIO_DIG = 0x00;
			GPIO_PLACE = PLACE_CODE[0];
			GPIO_DIG = 	leddata[LEDBuff[0]];
			i++;
			break;
		case 1:
			GPIO_DIG = 0x00;
			GPIO_DIG = 	leddata[LEDBuff[1]];
			GPIO_PLACE = PLACE_CODE[1];
			i++;
			break;
		case 2:
			GPIO_DIG = 0x00;
			GPIO_DIG = 	leddata[LEDBuff[2]];
			GPIO_PLACE = PLACE_CODE[2];
			i++;
			break;
		case 3:
			GPIO_DIG = 0x00;
			GPIO_DIG = 	leddata[LEDBuff[3]];
			GPIO_PLACE = PLACE_CODE[3];
			i++;
			break;
		case 4:
			GPIO_DIG = 0x00;
			GPIO_DIG = 	leddata[LEDBuff[4]];
			GPIO_PLACE = PLACE_CODE[4];
			i++;
			break;
		case 5:
			GPIO_DIG = 0x00;
			GPIO_DIG = 	leddata[LEDBuff[5]];
			GPIO_PLACE = PLACE_CODE[5];
			i++;
			break;
		case 6:
			GPIO_DIG = 0x00;
			GPIO_DIG = 	leddata[LEDBuff[6]];
			GPIO_PLACE = PLACE_CODE[6];
			i++;
			break;
		case 7:
			GPIO_DIG = 0x00;
			GPIO_DIG = 	leddata[LEDBuff[7]];
			GPIO_PLACE = PLACE_CODE[7];
			i = 0;
			break;
		default:
			break;
	}
	
}